From dbb5c70a0d11b83cbc5b777ed5b5aa3684b61fef Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 3 Dec 2010 09:36:47 +0000 Subject: [PATCH] libxc: osdep: convert xc_evtchn_unbind() Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson --- tools/libxc/xc_evtchn.c | 5 +++++ tools/libxc/xc_linux.c | 6 ++++-- tools/libxc/xc_minios.c | 12 +++++++----- tools/libxc/xc_netbsd.c | 6 ++++-- tools/libxc/xc_solaris.c | 6 ++++-- tools/libxc/xenctrlosdep.h | 2 ++ 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index fadb00cca7..81fc15b29a 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -107,6 +107,11 @@ xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq) return xce->ops->u.evtchn.bind_virq(xce, xce->ops_handle, virq); } +int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) +{ + return xce->ops->u.evtchn.unbind(xce, xce->ops_handle, port); +} + /* * Local variables: * mode: C diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index bc5cc279fc..9044020fe8 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -410,13 +410,14 @@ linux_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq) return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); } -int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) +static int linux_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port) { + int fd = (int)h; struct ioctl_evtchn_unbind unbind; unbind.port = port; - return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind); + return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind); } evtchn_port_or_error_t @@ -445,6 +446,7 @@ static struct xc_osdep_ops linux_evtchn_ops = { .bind_unbound_port = &linux_evtchn_bind_unbound_port, .bind_interdomain = &linux_evtchn_bind_interdomain, .bind_virq = &linux_evtchn_bind_virq, + .unbind = &linux_evtchn_unbind, }, }; diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c index b9587a493e..e01b4b4992 100644 --- a/tools/libxc/xc_minios.c +++ b/tools/libxc/xc_minios.c @@ -328,20 +328,21 @@ static evtchn_port_or_error_t minios_evtchn_bind_interdomain(xc_evtchn *xce, xc_ return local_port; } -int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) +static int minios_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port) { + int fd = (int)h; int i; for (i = 0; i < MAX_EVTCHN_PORTS; i++) - if (files[xce->fd].evtchn.ports[i].port == port) { - files[xce->fd].evtchn.ports[i].port = -1; + if (files[fd].evtchn.ports[i].port == port) { + files[fd].evtchn.ports[i].port = -1; break; } if (i == MAX_EVTCHN_PORTS) { - printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, xce->fd); + printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd); errno = -EINVAL; return -1; } - files[xce->fd].evtchn.ports[i].bound = 0; + files[fd].evtchn.ports[i].bound = 0; unbind_evtchn(port); return 0; } @@ -410,6 +411,7 @@ static struct xc_osdep_ops minios_evtchn_ops = { .bind_unbound_port = &minios_evtchn_bind_unbound_port, .bind_interdomain = &minios_evtchn_bind_interdomain, .bind_virq = &minios_evtchn_bind_virq, + .unbind = &minios_evtchn_unbind, }, }; diff --git a/tools/libxc/xc_netbsd.c b/tools/libxc/xc_netbsd.c index 85b4d5c308..9d708fce57 100644 --- a/tools/libxc/xc_netbsd.c +++ b/tools/libxc/xc_netbsd.c @@ -259,13 +259,14 @@ netbsd_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid, return -1; } -int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) +static int netbsd_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port) { + int fd = (int)h; struct ioctl_evtchn_unbind unbind; unbind.port = port; - return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind); + return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind); } static evtchn_port_or_error_t @@ -310,6 +311,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = { .bind_unbound_port = &netbsd_evtchn_bind_unbound_port, .bind_interdomain = &netbsd_evtchn_bind_interdomain, .bind_virq = &netbsd_evtchn_bind_virq, + .unbind = &netbsd_evtchn_unbind, }, }; diff --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c index 2bdb985b0f..ea786e79ee 100644 --- a/tools/libxc/xc_solaris.c +++ b/tools/libxc/xc_solaris.c @@ -252,13 +252,14 @@ solaris_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq) return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); } -int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) +static int solaris_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port) { + int fd = (int)h; struct ioctl_evtchn_unbind unbind; unbind.port = port; - return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind); + return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind); } evtchn_port_or_error_t @@ -287,6 +288,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = { .bind_unbound_port = &solaris_evtchn_bind_unbound_port, .bind_interdomain = &solaris_evtchn_bind_interdomain, .bind_virq = &solaris_evtchn_bind_virq, + .unbind = &solaris_evtchn_unbind, }, }; diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h index 1869ba2737..9091d0be8f 100644 --- a/tools/libxc/xenctrlosdep.h +++ b/tools/libxc/xenctrlosdep.h @@ -83,6 +83,8 @@ struct xc_osdep_ops evtchn_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid, evtchn_port_t remote_port); evtchn_port_or_error_t (*bind_virq)(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq); + + int (*unbind)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port); } evtchn; } u; }; -- 2.30.2